package servlet.buyShopping;

import com.google.gson.Gson;
import dao.AddressDao;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.Map;

@WebServlet(name = "QueryDefaultAddressServlet", value = "/QueryDefaultAddressServlet.s")
public class QueryDefaultAddressServlet extends HttpServlet {
    private AddressDao dao =new AddressDao();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        final String uid = request.getParameter("uid");
        final Map<String, Object> defaultAddress = dao.getDefaultAddress(uid);
        final String json = new Gson().toJson(defaultAddress);
        response.getWriter().append(json);
    }
}
